<%@ taglib prefix="from" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<script>

    $(function(){
        var  icdCode = $("#icdCode").val();
        if((icdCode != '' || icdCode != null) && icdCode.substring(0,1) == 'M'){
            $("div [name='MIcd1']").show();
            $("#MIcd1").val(icdCode);
            $("div [name='MIcd1']").css("color","red");
        } else {
            $("div [name='MIcd1']").hide();
        }

    })
    //获取诊疗项目
    IDC("icdCode");
    function IDC(inputId) {
        var url = "${ctx}/doctor/hisDataIcd10/automaticIcd";
        autoComplete(inputId, url, function (data) {
            var rows = [];
            for (var i = 0; i < data.length; i++) {
                rows[rows.length] = {
                    data: data[i],
                    value: data[i].id,
                    result: data[i].code
                };
            }
            return rows;
        }, function (data, i, max) {
            return '代码：'+data.code+'     /名称：'+data.zhongwenMingcheng;
        }, function (event, data, formatted) {
            if(data.code.substring(0,1) == 'M'){
                $("div [name='MIcd1']").show();
                $("#MIcd1").val(data.code);
                $("div [name='MIcd1']").css("color","red");
            }
            $("#IDCName").val(data.zhongwenMingcheng);
            $("#code").val(data.code);
            $("#icdName").val(data.zhongwenMingcheng);

        })
    }
    //关闭修改页面
    $(function () {
        $("#btnCancel").on('click', function () {
            hideShowTableTd('contentTable', '0,1,2,3,4,5,6', '1');
            $("#RightDiv").attr("style", "display: none");
            $("#LeftDiv").attr("class", "main-content col-lg-12");
            $("#LeftDiv").show('normal');
        })
        //添加修改
        $("#btnSubmit").on('click', function () {
            formSaveLoad("rigthDoctorCenterDiv", "inputForm", "${ctx}/doctor/hisDiagnosis/save", "${ctx}/doctor/hisDiagnosis/index?patientId=${patientId}&visitId=${visitId}");
            document.getElementById("inputForm").reset();
        })
    })
</script>
<div class="content-wrap">
    <div class="wrapper" style="bottom: 50px;">
        <section class="panel panel-default">
            <div class="panel-body">
                <div class="col-lg-12">
                    <form:form id="inputForm" data-parsley-validate="" modelAttribute="hisDiagnosis" method="post"
                               class="form-horizontal">
                        <form:hidden path="id"/>
                        <input type="hidden" name="inoroutFlag" value="1">
                        <input type="hidden" name="parent.id" value="${parentId}">
                        <input type="hidden" name="visitId" value="${visitId}">
                        <input type="hidden" name="patientId" value="${patientId}">
                        <input type="hidden" name="createDate" value="${time}">
                        <input type="hidden" name="diagnosisDoctor" value="${userName}">
                        <input type="hidden" name="clinicId" value="${clinicId}">

                        <div class="form-group">
                            <label class="col-sm-3 control-label">诊断类型：</label>

                            <div class="col-sm-8">
                                <form:select path="type" maxlength="64" class="form-control">
                                    <form:options items="${fns:getDictList('DIAGNOSIS_TYPE')}" htmlEscape="false"
                                                  itemLabel="label" itemValue="value"/>
                                </form:select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">ICD码：</label>

                            <div class="col-sm-8">
                                <form:input path="icdCode" id="icdCode" data-parsley-validate="true" name="diagnosis"
                                            htmlEscape="false" class="form-control" maxlength="40"/>
                            </div>
                        </div>
                        <div class="form-group" name="MIcd1">
                            <label class="col-sm-3 control-label">M码：</label>

                            <div class="col-sm-8">
                                <form:input path="" id="MIcd1" name="MIcd1" htmlEscape="false" class="form-control"  maxlength="64"/>
                            </div>
                        </div>
                        <div class="form-group" name="MIcd1">
                            <label class="col-sm-3 control-label">病理诊断：</label>
                            <div class="col-sm-8">
                                <from:textarea path="pathologicDiagnosis" id="pathologicDiagnosis" name="MIcd1" htmlEscape="false" class="form-control" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">诊断名称：</label>

                            <div class="col-sm-8">
                                <form:input path="icdName" id="icdName" htmlEscape="false" class="form-control"
                                            data-parsley-required="true" maxlength="64"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">诊断描述：</label>

                            <div class="col-sm-8">
                                <form:input path="description" id="description" htmlEscape="false" class="form-control"
                                            maxlength="64"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">治疗效果：</label>
                            <div class="col-sm-8">
                                <form:select path="effect" maxlength="64" class="form-control">
                                    <from:option value="">---请选择---</from:option>
                                    <form:options items="${fns:getDictList('TREATMENT_TYPE')}" htmlEscape="false"
                                                  itemLabel="label" itemValue="value"/>
                                </form:select>
                            </div>
                            <%--<div class="col-sm-8">
                                <form:input path="effect" id="basis" htmlEscape="false" class="form-control"
                                            maxlength="64"/>
                            </div>--%>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">是否手术：</label>

                            <div class="col-sm-8">
                                <form:select path="operation" maxlength="64" class="form-control">
                                    <form:options items="${fns:getDictList('YES_NO')}" htmlEscape="false"
                                                  itemLabel="label" itemValue="value"/>
                                </form:select>
                            </div>
                        </div>

                    </form:form>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <input id="btnSubmit" class="btn btn-primary" type="button" value="保存">&nbsp;
                        <input id="btnCancel" class="btn" type="button" value="关 闭"></div>
                </div>

                <input type="hidden" id="price" value="">
            </div>
        </section>
    </div>
</div>

